package com.liao.dao;

import com.liao.bean.Module;
import com.liao.bean.TreeNodeVo;

import java.util.List;
import java.util.Map;

public interface ModuleDao {

    /**
     * 根据账户有层级的查询所有菜单
     * @param account
     * @return
     * @throws Exception
     */
    List<Module> queryModuleListHierarchyByAccount(String account) throws Exception;

    /**
     * 查询所有菜单
     * @return
     * @throws Exception
     */
    List<Module> selectModuleList() throws Exception;

    /**
     * 根据菜单名称模糊查询菜单列表
     * @param moduleName
     * @return
     * @throws Exception
     */
    List<Module> selectModuleListLikeModuleName(String moduleName) throws Exception;

    /**
     * 查询所有一级菜单
     * @return
     * @throws Exception
     */
    List<Module> selectFirstModuleList() throws Exception;

    /**
     * 根据一级菜单查询所有二级菜单
     * @param parentModule
     * @return
     * @throws Exception
     */
    List<Module> selectChildModuleListByParentModule(String parentModule) throws Exception;

    /**
     * 有层级地查询所有菜单(树形结构)
     * @return
     */
    List<TreeNodeVo> selectTreeNodeListHierarchy() throws Exception;

    /**
     * 根据角色编号查询三级菜单(树形结构)
     * @param roleId
     * @return
     * @throws Exception
     */
    List<TreeNodeVo> selectThirdTreeNodeListByRoleId(String roleId) throws Exception;

    /**
     * 根据角色编号删除授权
     * @param roleId
     * @throws Exception
     */
    void deleteGrantsByRoleId(String roleId) throws Exception;

    /**
     * 授权
     * @param map
     * @throws Exception
     */
    void insertGrant(Map<String, Object> map) throws Exception;

    /**
     * 根据父级id查询最后一个子级菜单
     * @param parent_module
     * @return
     * @throws Exception
     */
    String selectModuleByFinallyId(String parent_module) throws Exception;


    /**
     * 根据菜单id和，菜单名称添到父级菜单
     * @param map
     * @throws Exception
     */
    void addFirstModule(Map<String, Object> map) throws Exception;

    /**
     * 判断菜单名称是否已经存在
     * @param map
     * @return
     */
    Module selectModuleByTitle(Map<String, Object> map) throws Exception;

    /**
     * 根据菜单id和，菜单名称添加到三级菜单
     * @param moduleId
     * @param title
     * @param parent_module
     * @param href
     */
    void addThirdModule(Map<String, Object> map) throws Exception;

    /**
     * 修改菜单
     * @param map
     * @throws Exception
     */
    void updateModule(Map<String, Object> map) throws Exception;

    /**
     * 删除菜单
     * @param moduleId
     * @throws Exception
     */
    void deleteModule(String moduleId) throws Exception;
}
